package 力扣日常刷题.木22一月.第15天0127;

import java.util.List;

/**
 * @author 帅小伙
 * @date 2022/1/27
 * @description
 */
public class Demo04简单字符串统计匹配检索规则的物品数量 {


    public int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {
        int i = 0,res=0;
        if (ruleKey.equals("color"))  i = 1;
        if (ruleKey.equals("name"))  i = 2;
        for (int j = 0; j < items.size(); j++) {
            if (items.get(j).get(i).equals(ruleValue))  res++;
        }
        return res;

    }

}
